<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>智能收款记录</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
    <script type="text/javascript">
        var grid = null;
        $(function () {
            $("#searchBar").ligerForm();
            $("#ligergrid1").ligerGrid({
                url: '<%=path%>/custpay/cmmIntelOrder/initList.do',
                method : 'get',
                parms:getSearchParams(),
                columns: [
                    { display: '订单号', name: 'id', width: 150, align: 'center', enabledSort:true},
                    { display: '还款手机', name: 'clientPhone', width: 100, align: 'center', enabledSort:true},
                    { display: '还款客户', name: 'clientName', width: 200, align: 'center', enabledSort:true},
                    { display: '收款账号', name: 'payAccount', width: 120, align: 'center', enabledSort:true},
                    { display: '应还金额(元)', name: 'orderAmtNm', width: 100, align: 'center', enabledSort:true},
                    { display: '实际到账金额(元)', name: 'sumMoneyNm', width: 100, align: 'center', enabledSort:true},
                    { display: '账号状态', name: 'orderStsNm', width: 80, align: 'center', enabledSort:true},
                    { display: '业务类型', name: 'busTypeNm', width: 100, align: 'center', enabledSort:true},
                    { display: '支付表号', name: 'payTabNo', minWidth: 400 , isEllipsis: false,align: 'left', enabledSort:true},
                    { display: '创建时间', name: 'crtTm', width: 150, render:renderDate, align: 'center', enabledSort:true}
                ],
                pageSize:10,
                root:'rows',
                record:'total',
                hideLoadButton : true,
                width: '100%',
                height:'100%',
                heightDiff:-2,
                //checkbox:true,
                rownumbers:false,
                fixedCellHeight: false,
                onBeforeShowData: function ()
                {
                    var grid = this;
                    grid.collapsedRows = [];
                },
                detail: {
                    height: 'auto',
                    onShowDetail: showDetail_grid
                }
            });
            grid = liger.get("ligergrid1");

            $("#searchBtn").click(function(event) {
                var form = new liger.get("searchBar");
                var data = form.getData();
                console.log(data);
                for (name in data){
                    grid.setParm(name,data[name]);
                };
                grid.reload();
            });
            $("#clearBtn").click(function(event) {
                clearLigerForm("searchBar");
            });
            $("#dateform").ligerForm();
        });

        function showDetail_grid(row, detailPanel, callback){
            var gridBox = document.createElement('div');
            $(gridBox).css('margin', 10);
            $(detailPanel).css({
                'padding': 10,
                'box-sizing': 'border-box'
            }).append(gridBox);
            detailGrid = $(gridBox).ligerGrid({
                url: '<%=path%>/custpay/cmmIntelOrder/searchChdListByParentId.do?parOrderId='+row.id,
                method: 'get',
                columns: [
                    {display: '汇款订单号', name: 'id', width: 200, align: 'center'},
                    {display: '汇款人', name: 'oppAccountNm', width: 150, align: 'center'},
                    {display: '汇款人账号', name: 'oppAccountNo', width: 150, align: 'center'},
                    {display: '汇款金额（元）', name: 'orderAmtNm', width: 150, align: 'center'},
                    {display: '分解状态', name: 'isDecsucNm', width: 100, align: 'center'},
                    {display: '资金编号', name: 'fundCode', width: 200, align: 'center'},
                    {display: '到账时间', name: 'payTm', width: 150, render:renderDate, align: 'center', enabledSort:true}

                ],
                root: 'rows',
                hideLoadButton : true,
                width: '100%',
                height: 'auto',
                isScroll: false,
                rownumbers:true,  //显示序号
                checkbox:true,
                allowUnSelectRow:true,
                alternatingRow: true,
                onAfterShowData: callback,
                frozen: false,
                usePager: false
            });
        }

        //查询参数
        function getSearchParams(){
            var form = new liger.get("searchBar");
            var data = form.getData();
            return data;
        }
        //格式化时间
        function renderDate(rowdata, index, value){
            var dateStr = "";
            if(null != value){
                var date = new Date(value);
                dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
            }
            return dateStr;
        }

    </script>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">订单状态</div>
                    <div class="field">
                        <select name="orderStsCd"  id="orderStsCd"  disabled="disabled">
                            <option value="  " selected="selected">--请选择--</option>
                            <c:forEach items="${orderStsList}" var="opt">
                                <option value="${opt.key}" <c:if test="${opt.key==1}">selected</c:if>>${opt.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">手机号</div>
                    <div class="field">
                        <input name="clientPhone" id="clientPhone" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">姓名</div>
                    <div class="field">
                        <input name="clientName" id="clientName" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">收款账号</div>
                    <div class="field">
                        <input name="payAccount" id="payAccount" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">业务类型</div>
                    <div class="field">
                        <select name="busTypeCd"  id="busTypeCd"  disabled="disabled">
                            <option value=" " selected="selected">--请选择--</option>
                            <c:forEach items="${busTypCdList}" var="opt">
                                <option value="${opt.key}">${opt.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                    <div style="display: none">
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">创建时间(起)</div>
                    <div class="field">
                        <input name="crtTmBegin" id="crtTmBegin" type="text" class="ui-datepicker" value="">
                    </div>
                </div>
                <div class="fieldBox col_33">
                    <div class="label">创建时间(止)</div>
                    <div class="field">
                        <input name="crtTmEnd" id="crtTmEnd" type="text" class="ui-datepicker" value="">
                    </div>
                </div>

                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_1"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_19"></i>清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>

</body>
</html>
